#ifndef CPP_ANIMATION_MANAGER_H
#define CPP_ANIMATION_MANAGER_H

/**
 * @brief 动画
 * @author CVTE
 * 动画管理器
 */
#include <mgeff/mgeff.h>
#include <widget/View.h>
#include <Bitmap.h>
#include <animation/Animation.h>
#include <vector>

/*  //参考代码
    AnimationManager* animationManager = AnimationManager::getInstance();
    animationManager->prepareAnimation();
    TextView* wifiTitle = dynamic_cast<TextView*>(decorView->findViewById(ACT_SETTINGS_VIEW_ID_DETAIL_WIFI_TITLE));
    animationManager->addAnimation(new Animation(*wifiTitle, ANIMATION_TYPE_VISIABLE_CHANGE, View::INVISIBLE, ANIMATION_EFFECT_RIGHT_LEFT_ZOOM, ANIMATION_EFFECT_FLAG_FORWARD));
    animationManager->startAnimation();
*/

//@brief 动画管理器
//@author cvte
//@description 用于管理多个动画并控制动画播放
class AnimationManager {
   public:
    static AnimationManager* getInstance();

    AnimationManager();
    ~AnimationManager();

    //@method 动画准备
    void prepareAnimation();
    //@method 增加动画
    void addAnimation(Animation* animation);
    //@method 开始动画
    void startAnimation();
    //@method 处理动画，如果动画结束返回false，否则返回true
    bool processAnimation();
    //@method 结束动画
    void endAnimation();
    //@method 是否在进行动画中
    bool isDoingAnimation();

   private:
    typedef std::vector<Animation*> AnimationVector;
    static AnimationManager* sInstance;
    bool mIsDoingAnimation = false;
    Timer mAnimationTimer;
    AnimationVector mAnimationVector;
    Bitmap* mBackgroundBitmap = nullptr; //动态效果的背景图片
};

#endif
